﻿Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class Access
    ''' <summary>
    ''' 连接字符串
    ''' </summary>
    ''' <remarks></remarks>

    Private Const connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\MapDb.mdb"


    ''' <summary>
    ''' 从数据库取数据进行查询操作
    ''' </summary>
    ''' <param name="sql"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetDs(ByVal sql As String) As DataSet
        Dim dar As OleDbDataAdapter = New OleDbDataAdapter(sql, connString)
        Dim ds As DataSet = New DataSet
        dar.Fill(ds)
        Return ds

    End Function

    Public Sub DoSql(ByVal sql As String)
        Try
            Dim conn As OleDbConnection = New OleDbConnection(connString)
            conn.Open()
            Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)
            cmd.ExecuteNonQuery()
            conn.Close()
        Catch ex As Exception

        End Try

    End Sub

End Class
